package com.tongji.showroom
{
	import com.tongji.showroom.command.GetUserProductCommand;
	import com.tongji.showroom.command.GetSystemSceneCommand;
	import com.tongji.showroom.command.GetUserSceneCommand;
	import com.tongji.showroom.events.GetUserProductEvent;
	import com.tongji.showroom.events.GetSystemSceneEvent;
	import com.tongji.showroom.events.GetUserSceneEvent;
	import com.tongji.showroom.model.FurnitureModel;
	import com.tongji.showroom.model.SystemSceneModel;
	import com.tongji.showroom.model.ProductModel;
	import com.tongji.showroom.model.UserModel;
	import com.tongji.showroom.model.UserSceneModel;
	import com.tongji.showroom.service.GetSystemSceneService;
	import com.tongji.showroom.service.UserProductService;
	import com.tongji.showroom.service.UserSceneService;
	import com.tongji.showroom.view.EditSceneMediator;
	import com.tongji.showroom.view.EditSceneView;
	import com.tongji.showroom.view.ReleaseScenceMediator;
	import com.tongji.showroom.view.ReleaseSenceComp;
	import com.tongji.showroom.view.SelectedFurnitureDataListItemRenderer;
	import com.tongji.showroom.view.SelectedFurnitureItemRendererMediator;
	import com.tongji.showroom.view.WorkComp;
	import com.tongji.showroom.view.WorkCompMediator;
	import com.tongji.showroom.view.titleWindows.FilterTitleWinMediator;
	import com.tongji.showroom.view.titleWindows.FilterTitleWindow;
	import com.tongji.showroom.view.titleWindows.SingleFurnitureTitleWindow;
	import com.tongji.showroom.view.titleWindows.SingleFurnitureTitleWindowMediator;
	
	import flash.display.DisplayObjectContainer;
	
	import org.robotlegs.mvcs.Context;
	
	/**
	 * 
	 * @author yanghanbing
	 * 2011/7/11
	 */
	
	public class ShowRoomContext extends Context
	{
		public function ShowRoomContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
		{
			super(contextView, autoStartup);
		}
		
		override public function startup():void
		{			
			
			//model
			injector.mapSingleton(SystemSceneModel);
			injector.mapSingleton(FurnitureModel);
			injector.mapSingleton(ProductModel);
			injector.mapSingleton(UserSceneModel);
			injector.mapSingleton(UserModel);
			
			//Service
			injector.mapSingleton(GetSystemSceneService);
			injector.mapSingleton(UserProductService);
			injector.mapSingleton(UserSceneService);
			//mapView
			mediatorMap.mapView(ReleaseSenceComp, ReleaseScenceMediator);
			mediatorMap.mapView(EditSceneView, EditSceneMediator);
			mediatorMap.mapView(FilterTitleWindow, FilterTitleWinMediator);
			mediatorMap.mapView(SingleFurnitureTitleWindow, SingleFurnitureTitleWindowMediator);
			mediatorMap.mapView(WorkComp, WorkCompMediator);
			mediatorMap.mapView(SelectedFurnitureDataListItemRenderer, SelectedFurnitureItemRendererMediator);
			
			//mapEvent
			commandMap.mapEvent(GetUserProductEvent.GET_USER_PRODUCT, GetUserProductCommand);
			commandMap.mapEvent(GetUserProductEvent.UPDATE_USER_MODEL, GetUserProductCommand);
			commandMap.mapEvent(GetSystemSceneEvent.GET_ALL_SCENE, GetSystemSceneCommand);
			commandMap.mapEvent(GetSystemSceneEvent.UPDATE_ALL_SCENE, GetSystemSceneCommand);
			commandMap.mapEvent(GetUserSceneEvent.GET_USER_SCENE, GetUserSceneCommand);
			commandMap.mapEvent(GetUserSceneEvent.UPDATE_USER_SCENE, GetUserSceneCommand);
		}
	}
}